package org.gruposp2p.aularest.server;

import java.util.logging.Logger;
import org.gruposp2p.aularest.server.resource.AbsenceResource;
import org.gruposp2p.aularest.server.resource.AbsencesResource;
import org.gruposp2p.aularest.server.resource.AddressResource;
import org.gruposp2p.aularest.server.resource.AddressesResource;
import org.gruposp2p.aularest.server.resource.CompetenceResource;
import org.gruposp2p.aularest.server.resource.CompetencesResource;
import org.gruposp2p.aularest.server.resource.CourseResource;
import org.gruposp2p.aularest.server.resource.CoursegroupResource;
import org.gruposp2p.aularest.server.resource.CoursegroupsResource;
import org.gruposp2p.aularest.server.resource.CoursesResource;
import org.gruposp2p.aularest.server.resource.ItemcalificableResource;
import org.gruposp2p.aularest.server.resource.ItemcalificablesResource;
import org.gruposp2p.aularest.server.resource.ItemcalificabletypeResource;
import org.gruposp2p.aularest.server.resource.ItemcalificabletypesResource;
import org.gruposp2p.aularest.server.resource.ScoreResource;
import org.gruposp2p.aularest.server.resource.ScoresResource;
import org.gruposp2p.aularest.server.resource.StudentResource;
import org.gruposp2p.aularest.server.resource.StudentsResource;
import org.gruposp2p.aularest.server.resource.SubjectResource;
import org.gruposp2p.aularest.server.resource.SubjectsResource;
import org.gruposp2p.aularest.server.resource.TutorResource;
import org.gruposp2p.aularest.server.resource.TutorsResource;
import org.gruposp2p.aularest.utils.AulaLogger;
import org.restlet.Application;
import org.restlet.Restlet;
import org.restlet.routing.Router;

/**
 *
 * @author jj
 */
public class AulaApplication extends Application {

    private static final Logger logger =
        AulaLogger.getLogger(AulaApplication.class.getName());

    private static AulaApplication instance;

    public AulaApplication() {  }

    /**
     * Returns the root Restlet of this application.
     */
    @Override
    public Restlet createRoot() {
        //router.attach(LinkConstants., .class);
        Router router = new Router(getContext());
        router.attach(LinkConstants.COURSES_PATH, CoursesResource.class);
        router.attach(LinkConstants.COURSE_PATH, CourseResource.class);

        router.attach(LinkConstants.COURSEGROUPS_PATH, CoursegroupsResource.class);
        router.attach(LinkConstants.COURSEGROUP_PATH, CoursegroupResource.class);

        router.attach(LinkConstants.STUDENTS_PATH, StudentsResource.class);
        router.attach(LinkConstants.STUDENT_PATH, StudentResource.class);

        router.attach(LinkConstants.ADDRESSES_PATH, AddressesResource.class);
        router.attach(LinkConstants.ADDRESS_PATH, AddressResource.class);

        router.attach(LinkConstants.TUTORS_PATH, TutorsResource.class);
        router.attach(LinkConstants.TUTOR_PATH, TutorResource.class);

        router.attach(LinkConstants.SUBJECTS_PATH, SubjectsResource.class);
        router.attach(LinkConstants.SUBJECT_PATH, SubjectResource.class);

        router.attach(LinkConstants.COMPETENCES_PATH, CompetencesResource.class);
        router.attach(LinkConstants.COMPETENCE_PATH, CompetenceResource.class);

        router.attach(LinkConstants.ITEMCALIFICABLETYPES_PATH,
                ItemcalificabletypesResource.class);
        router.attach(LinkConstants.ITEMCALIFICABLETYPE_PATH,
                ItemcalificabletypeResource.class);

        router.attach(LinkConstants.ITEMCALIFICABLES_PATH,
                ItemcalificablesResource.class);
        router.attach(LinkConstants.ITEMCALIFICABLE_PATH,
                ItemcalificableResource.class);

        router.attach(LinkConstants.ABSENCES_PATH,
                AbsencesResource.class);
        router.attach(LinkConstants.ABSENCE_PATH,
                AbsenceResource.class);

        router.attach(LinkConstants.SCORES_PATH,
                ScoresResource.class);
        router.attach(LinkConstants.SCORE_PATH,
                ScoreResource.class);
        
        //router.attach(LinkConstants.CURSOS_PATH, CursosResource.class);
        //router.attach(LinkConstants.CURSO_PATH + "/{cursoID}", CursoResource.class);
        //router.attach(LinkConstants.GRUPOS_PATH, GruposResource.class);
        //router.attach(LinkConstants.GRUPO_PATH + "/{grupoID}", GrupoResource.class);
        //router.attach("", new MainPage());

        //router.attach("", MainPageResource.class);

        return router;
    }

}

